{% extends "admin/change_list.html" %}

{% block javascripts %}
    {{ block.super }}
    <script type="text/javascript">
        function show_filters(){
            $.post(  
                "{% url admin_advanced_filter.views.get_filters cl.opts.app_label cl.opts.module_name %}",  
                '',
                function(data){  
                    $("#filter_content_box").html(data);
                }  
            ); 
            $("#advanced_filter_box").overlay({
                    top: '3',
                    fixed: false
                });
            $("#advanced_filter_box").overlay().load();
            return false;
        }
        function show_filter_field(ct_id, field_name){
            $.post(  
                "{% url admin_advanced_filter.views.get_filter_field %}?ct_id=" + ct_id + "&field_name=" + field_name,  
                '',
                function(data){  
                    $("#filter_content_box").html(data);
                }  
            );
        }
    </script>
{% endblock %}

{% block object-tools-items %}
    {% if not is_popup %}
        <li><a href="javascript:;" onclick="show_filters()">Advanced Filter</a></li>
    {% endif %}
    {{block.super}}
{% endblock %}

{% block content %}
    {{ block.super }}
    <div class="modal" id="advanced_filter_box">
        <div id="filter_content_box">
            <button class="close"> Close </button>
        </div>
    </div>
{% endblock %}
